package cn.xiaoyao.wx_account.enums;

import cn.hutool.core.util.StrUtil;

/**
 * @description:
 * @author: xiaoyao
 * @date: 2024/9/21 18:35
 */
public enum WxMpEvent {

    SCAN("SCAN","扫码"),
    SUBSCRIBE("subscribe","订阅"),
    UNSUBSCRIBE("unsubscribe","取消订阅"),
    ;
    private String code;
    private String value;
    WxMpEvent(String code,String value) {
        this.code = code;
        this.value = value;
    }

    public String getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    public static WxMpEvent getEventCode(String value) {
        if (StrUtil.isBlank(value)) {
            return null;
        }
        for (WxMpEvent wxMpEvent : WxMpEvent.values()) {
            if (wxMpEvent.getCode().equals(value)) {
                return wxMpEvent;
            }
        }
        return null;
    }
}
